package com.cyj.dream.core.constant;

/**
 * @Description: 常量--安全
 * @BelongsProject: DreamChardonnay
 * @BelongsPackage: com.cyj.dream.core.constant
 * @Author: ChenYongJia
 * @CreateTime: 2021-09-27 13:03
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
public class SecurityConstants {


    /**
     * 角色前缀
     */
    public static final String ROLE = "ROLE_";

    /**
     * 前缀
     */
    public static final String PROJECT_PREFIX = "sos_";

    /**
     * 项目的license
     */
    public static final String PROJECT_LICENSE = "made by sos";

    /**
     * 内部
     */
    public static final String FROM_IN = "Y";

    /**
     * 标志
     */
    public static final String FROM = "from";

    /**
     * 默认登录URL
     */
    public static final String OAUTH_TOKEN_URL = "/oauth/token";

    /**
     * grant_type:refresh_token
     */
    public static final String REFRESH_TOKEN = "refresh_token";
    /**
     * grant_type:password
     */
    public static final String GRANT_TYPE_PASSWORD = "password";
    /**
     * grant_type:authorization_code
     */
    public static final String GRANT_TYPE_AUTHORIZATION_CODE = "authorization_code";
    /**
     * grant_type:client_credentials
     */
    public static final String GRANT_TYPE_CLIENT_CREDENTIALS = "client_credentials";

    /**
     * grant_type:custom_phone_open_code
     */
    public static final String GRANT_TYPE_CUSTOM_PHONE_OPEN_CODE = "custom_phone_open_code";

    /**
     * grant_type:custom_qr_code
     */
    public static final String GRANT_TYPE_CUSTOM_QR_CODE = "custom_qr_code";

    /**
     * grant_type:custom_ding_id
     */
    public static final String GRANT_TYPE_CUSTOM_DING_ID = "custom_ding_id";

    /**
     * {bcrypt} 加密的特征码
     */
    public static final String BCRYPT = "{bcrypt}";

    /**
     * sys_oauth_client_details 表的字段，不包括client_id、client_secret
     */
    public static final String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
            + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
            + "refresh_token_validity, additional_information, autoapprove";

    /**
     * JdbcClientDetailsService 查询语句
     */
    public static final String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS + " from sys_oauth_client_details";

    /**
     * 默认的查询语句
     */
    public static final String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";

    /**
     * 按条件client_id 查询
     */
    public static final String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";

    /***
     * 资源服务器默认bean名称
     */
    public static final String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";

    /**
     * 用户ID字段
     */
    public static final String DETAILS_USER_ID = "userId";

    /**
     * 用户名字段
     */
    public static final String DETAILS_USERNAME = "user_name";

    /**
     * 用户部门字段
     */
    public static final String DETAILS_DEPT_INFO = "userDeptId";

    /**
     * 微信的openCode
     */
    public static final String DETAILS_OPEN_CODE = "open_code";

    /**
     * 用户信息
     */
    public static final String DETAILS_USERINFO = "userInfo";

    /**
     * 协议字段
     */
    public static final String DETAILS_LICENSE = "license";

    /**
     * 验证码有效期,默认 60秒
     */
    public static final long CODE_TIME = 60;
    
}
